package cn.edu.scau.cmi.mengzhuorong.client;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.beans.factory.BeanFactory;
import cn.edu.scau.cmi.mengzhuorong.spring.domain.Student;
import cn.edu.scau.cmi.mengzhuorong.spring.domain.Teacher;
import cn.edu.scau.cmi.mengzhuorong.spring.util.ApplicationContextUtil;
import java.lang.Runnable;

public class Spring01Client implements Runnable {
	private static Teacher liangzhaoqing;
	private static Student zhangsan;
	public Spring01Client() {
		
	}
	public static void main(String arg[]) {
		ApplicationContext ac = getApplicationContext();
		Student zhangsan = (Student) ac.getBean("zhangsan");
		System.out.println(zhangsan.getName() + "的导师是：" + zhangsan.getTutor().getName());
	}
	
	private static ApplicationContext getApplicationContext() {
		ApplicationContext applicationContext = ApplicationContextUtil.getapplicationContext();
		return applicationContext;
	}
	
	@Override
	public void run() {
		this.main(null);
	}
}
